#include <iostream>
using namespace std;

int min(int a, int b)
{
  if(a < b)
  {
    return a;
  }
  return b;
}

int max(int a, int b)
{
  if(a > b)
  {
    return a;
  }
  return b;
}

int main()
{
  int a,b,c;
  for(a = 1; a < 1000; a++)
  {
    for(b = 1; b < 1000 - a; b++)
    {
      for(c = (max(a,b) - min(a,b)); c < 1001 - a - b; c++)
      {
        if(((a*a + b*b == c*c) || (a*a + c*c == b*b) || (b*b + c*c == a*a)) &&
           (a + b + c == 1000))
        {
          cout << a << ", " << b << ", and " << c << endl;
          cout << "a*b*c = " << a*b*c << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}
